package com.industrial.premu.controller;

import java.util.List;
import javax.servlet.http.HttpServletResponse;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.industrial.common.log.annotation.Log;
import com.industrial.common.log.enums.BusinessType;
import com.industrial.common.security.annotation.RequiresPermissions;
import com.industrial.premu.domain.PreMuStandardIndustryInfo;
import com.industrial.premu.service.IPreMuStandardIndustryInfoService;
import com.industrial.common.core.web.controller.BaseController;
import com.industrial.common.core.web.domain.AjaxResult;
import com.industrial.common.core.utils.poi.ExcelUtil;
import com.industrial.common.core.web.page.TableDataInfo;

/**
 * 行业信息Controller
 * 
 * @author Zhou_S
 * @date 2024-02-01
 */
@RestController
@RequestMapping("/standard_industry")
public class PreMuStandardIndustryInfoController extends BaseController
{
    @Autowired
    private IPreMuStandardIndustryInfoService preMuStandardIndustryInfoService;

    /**
     * 查询行业信息列表
     */
    @GetMapping("/list")
    public TableDataInfo list(PreMuStandardIndustryInfo preMuStandardIndustryInfo)
    {
        startPage();
        List<PreMuStandardIndustryInfo> list = preMuStandardIndustryInfoService.selectPreMuStandardIndustryInfoList(preMuStandardIndustryInfo);
        return getDataTable(list);
    }

    /**
     * 导出行业信息列表
     */
    @RequiresPermissions("premu:standard_industry:export")
    @Log(title = "行业信息", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    public void export(HttpServletResponse response, PreMuStandardIndustryInfo preMuStandardIndustryInfo)
    {
        List<PreMuStandardIndustryInfo> list = preMuStandardIndustryInfoService.selectPreMuStandardIndustryInfoList(preMuStandardIndustryInfo);
        ExcelUtil<PreMuStandardIndustryInfo> util = new ExcelUtil<PreMuStandardIndustryInfo>(PreMuStandardIndustryInfo.class);
        util.exportExcel(response, list, "行业信息数据");
    }

    /**
     * 获取行业信息详细信息
     */
    @RequiresPermissions("premu:standard_industry:query")
    @GetMapping(value = "/{ID}")
    public AjaxResult getInfo(@PathVariable("ID") String ID)
    {
        return success(preMuStandardIndustryInfoService.selectPreMuStandardIndustryInfoByID(ID));
    }

    /**
     * 新增行业信息
     */
    @RequiresPermissions("premu:standard_industry:add")
    @Log(title = "行业信息", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody PreMuStandardIndustryInfo preMuStandardIndustryInfo)
    {
        return toAjax(preMuStandardIndustryInfoService.insertPreMuStandardIndustryInfo(preMuStandardIndustryInfo));
    }

    /**
     * 修改行业信息
     */
    @RequiresPermissions("premu:standard_industry:edit")
    @Log(title = "行业信息", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody PreMuStandardIndustryInfo preMuStandardIndustryInfo)
    {
        return toAjax(preMuStandardIndustryInfoService.updatePreMuStandardIndustryInfo(preMuStandardIndustryInfo));
    }

    /**
     * 删除行业信息
     */
    @RequiresPermissions("premu:standard_industry:remove")
    @Log(title = "行业信息", businessType = BusinessType.DELETE)
	@DeleteMapping("/{IDs}")
    public AjaxResult remove(@PathVariable String[] IDs)
    {
        return toAjax(preMuStandardIndustryInfoService.deletePreMuStandardIndustryInfoByIDs(IDs));
    }
}
